-- Quest: C:\QUESTS\WORKING\S0000503.Qbn.
-- Main story quest.
-- QuestId: 503
Messages: 72
Quest: S0000503
-- Message panels
QRC:

Message:  1020
%qdt:
 I have received a mysterious summons
 to _tavern_ in __tavern_
 in ____tavern_, I believe by my friend _rebel_.

Message:  1021
%qdt:
 I have agreed to help _rebel_
 "liberate" a map to ___itemdung_
 from the Mages Guild of __magesguild_.

Message:  1022
%qdt:
 We have retrieved the map.  _rebel_
 has another matter to attend to, so
 I will meet him back in _tavern_
 in =keytime_ days.

Message:  1023
%qdt:
 We have retrieved the map.  I have
 offered to go to ___keydung_
 to find a special _key_ which we
 need to enter ___itemdung_.
 I will meet _rebel_ back in
 _tavern_ in =keytime_ days.

Message:  1030
<ce>                    A tattered map to ___itemdung_.

Message:  1040
<ce>               It was good of you to come.  I have a new
<ce>             project that I think you might be interested
<ce>               in.  It will involve a little raid on our
<ce>                 friends at the Mages Guild, however.
<ce>                           What do you say?

Message:  1041
<ce>                Have it your way.  I thought you and I
<ce>                       were friends, that's all.

Message:  1042
<ce>             I knew you couldn't resist!  Here's the plan.
<ce>             For some time now, I have been searching for
<ce>                the location of ___itemdung_, reputedly
<ce>           the resting place of a hoard of magical objects,
<ce>              including one _item_ that I need for my own
<ce>              purposes -- another story for another time.
<ce>             The issue at hand is that I have learned that
<ce>               the Mages Guild of __magesguild_ has come
<ce>               into possession of a map to ___itemdung_.
<ce>           I still have a few friends in the Guild, despite
<ce>             the official ban against me... The Guild has
<ce>             no idea what they have, so it is up to us to
<ce>              liberate the map so that it can be used to
<ce>                          its full potential.

Message:  1043
<ce>                         Yes, this is the map!

Message:  1044
<ce>                       _rebel_ raises his staff.
<ce>           "Ladies, gentlemen, we really must be going now."
<ce>               A sphere of light bursts from the staff,
<ce>                     blinding you for an instant.

QuestTimeLapse:  [1045]
<ce>           I think it would be best to separate for the time
<ce>           being, to let this hornet's nest calm down a bit.
<ce>           I have one more matter to attend to before we can
<ce>                   enter ___itemdung_ ... unless you
<ce>                    would like to handle it for me?

Message:  1046
<ce>          Very well.  ___itemdung_ cannot be entered without
<ce>          the key, a _key_ which I have learned is somewhere
<ce>           in ___keydung_.  Once you get the _key_, meet me
<ce>           in _tavern_ in __tavern_, say, in =keytime_ days.

Message:  1047
<ce>            No matter.  I will need, say, =keytime_ days to
<ce>             take care of this business.  I will meet you
<ce>                    back in __tavern_, at _tavern_,
<ce>                    when I have acquired the key to
<ce>                       ___itemdung_.  Good luck!

Message:  1050
<ce>           This must be the _key_, the key to ___itemdung_.

Message:  1051
<ce>          With this _key_ in our possession, we are ready to
<ce>               brave ___itemdung_.  Lead on, my friend!

Message:  1052
<ce>                         A hollow voice booms,
<ce>                   "Intruders are not welcome here!"

Message:  1053
<ce>              You are too late, _rebel_!  It was a simple
<ce>              matter to follow you to ___itemdung_, once
<ce>              you had found the _key_ for me.  The _item_
<ce>                     is now mine, and mine alone!

Message:  1054
<ce>             "Well, friend %pcf, an enjoyable little jaunt
<ce>             eh?  I'll take the _item_ and be on my way."
<ce>                                    
<ce>                  Do you give the _item_ to _rebel_?

Message:  1055
<ce>                           Until next time!

Message:  1056
<ce>                     So, your true colors at last.
<ce>                   I only asked for one small thing,
<ce>                       yet your greed apparently
<ce>                           knows no bounds.

Message:  1070
<ce>                   A shadow flits overhead.  A raven
<ce>                  circles, cawing out harshly before
<ce>                      disappearing into the west:
<ce>                                    
<ce>                          "No time!  No time!
<ce>                               _tavern_,
<ce>                               __tavern_
<ce>                             ____tavern_!"

Message:  1071
<ce>                          %pcf, are you lost?
<ce>                         I'm afraid I'll have
<ce>                           to leave you now.


-- Symbols used in the QRC file:
--
--               %g3 occurs 1 time.
--              %pcf occurs 2 times.
--              %qdt occurs 4 times.
--         =keytime_ occurs 7 times.
--       ____tavern_ occurs 3 times.
--      ___itemdung_ occurs 14 times.
--       ___keydung_ occurs 2 times.
--     __magesguild_ occurs 4 times.
--         __tavern_ occurs 5 times.
--            _item_ occurs 8 times.
--             _key_ occurs 7 times.
--           _rebel_ occurs 14 times.
--          _tavern_ occurs 10 times.

QBN:
Item _letter_ letter
Item _item_ magic_item
Item _map_ letter used 1030
Item _I.03_ magic_item
Item _I.04_ magic_item
Item _I.05_ gold
Item _key_ item class 10 subclass 11

Person _rebel_ face 1 named Baltham_Greyman
Person _dummy_ face 249 group Spellcaster

Place _tavern_ remote tavern
--Place aide remote dungeon
Place _magesguild_ remote magery
Place _itemdung_ remote dungeon
Place _keydung_ remote dungeon
Place _L.05_ remote dungeon

Clock _S.00_ 62.12:00 97.05:20
Clock _S.02_ 30.00:00 0 flag 1 range 0 1
Clock _S.10_ 00:00 0 flag 1 range 0 2
Clock _S.11_ 00:01
Clock _keytime_ 00:00 0 flag 1 range 0 5
Clock _S.21_ 6.22:40 0 flag 1 range 0 1
Clock _S.31_ 00:00 0 flag 17 range 0 2

Foe _guards_ is 3 Mage
Foe _guardian_ is Battle_mage
Foe _F.03_ is Mage

--	Quest start-up:
	start timer _S.00_ 
	give item _I.05_ to _guardian_ 
	give item _I.04_ to _guardian_ 
	give item _I.03_ to _guardian_ 
	give item _item_ to _guardian_ 
	pc at _magesguild_ set _S.04_ 
	pc at _itemdung_ set _S.16_ 
	_map_ used do _readmap_ 
	place foe _guardian_ at _itemdung_ 

_S.00_ task:
	place item _map_ at _magesguild_ 
	start timer _S.02_ 
	have _letter_ set _S.01_ 
	give pc _letter_ notify 1070 

_S.01_ task:
	take _letter_ from pc 
	log 1020 step 0 
	place npc _rebel_ at _tavern_ 

variable _S.02_
_S.03_ task:
	clicked npc _rebel_ 
	start task _S.18_ 

variable _S.04_
_S.05_ task:
	clicked item _item_ 

_S.06_ task:
	when _S.21_ and not _S.19_ 
	when _S.02_ and not _S.08_ 

variable _S.07_
_S.08_ task:
	start timer _S.10_ 
	log 1021 step 1 
	say 1042 
	add _rebel_ face 
	hide npc _rebel_
	stop timer _S.02_

_target_ task:
	say 1041 
	remove log step 0
--log message would stay in journal without this

variable _S.10_
_S.11_ task:
	say 1044 
	restrain foe _guards_ 

_S.12_ task:
	when _S.32_ and not _S.04_ 
	start timer _keytime_ 
	prompt 1045 yes _spouse_ no _S.14_ 
	drop _rebel_ face 
	change repute with _dummy_ by -15 
	stop timer _S.10_

_spouse_ task:
	place item _key_ at _keydung_ 
	reveal _keydung_ 
	log 1023 step 2 
	say 1046 
	restore _rebel_

_S.14_ task:
	log 1022 step 2 
	say 1047 
	clear _S.03_

_house1_ task:
	clicked item _key_ 
	say 1050 
	clear _S.03_

_S.16_ task:
	have _key_ set _S.25_ 

_keytime_ task:
	start timer _S.21_ 
	place npc _rebel_ at _tavern_
	restore _rebel_

_S.18_ task:
	prompt 1040 yes _S.08_ no _target_ 

_S.19_ task:
	when _S.03_ and _house1_ and _spouse_ 
	when _S.14_ and _S.03_ 
	start timer _S.31_
	stop timer _keytime_ 
	say 1051 
	hide npc _rebel_ 
	add _rebel_ face 
--there's still a lingering bug here that I can't figure out. If you do the S.14 route, Baltham's sprite will remain visible at this point. I don't know why.


variable _S.20_
variable _S.21_
_S.22_ task:
	when _S.31_ and not _S.30_ 
	when _S.10_ and not _S.12_ 
	say 1071 

_readmap_ task:
	reveal _itemdung_ 

_S.24_ task:
	when _S.16_ and not _S.25_ 
	reveal _L.05_ 
	say 1052 
	teleport pc to _L.05_ 
	unset _S.24_ 

variable _S.25_
_hitguardian_ task:
	injured _guardian_ 
	say 1053 

_S.27_ task:
	killed 1 _guardian_ 

_S.28_ task:
	take _item_ from pc 
	say 1055 

_S.29_ task:
	create foe _F.03_ every 0 minutes 1 times with 100% success 
	say 1056 
	make _item_ permanent 

_S.30_ task:
	when _S.05_ and not _S.16_ 
	prompt 1054 yes _S.28_ no _S.29_ 
	drop _rebel_ face 

variable _S.31_
_S.32_ task:
	clicked item _map_ 
	create foe _guards_ every 0 minutes 1 times with 100% success 
--sometimes this would delay much, and spawn after fast travel + pacify message
	start timer _S.11_ 
	say 1043 

_S.33_ task:
	when _S.06_ or _S.22_ or _S.31_ or _S.28_ 
	make _I.05_ permanent 
	make _I.04_ permanent 
	make _I.03_ permanent 
	end quest 

_S.34_ task:
	when _S.19_ and _S.14_ 
	get item _key_ 

_S.35_ task:
	killed _F.03_
	make _I.05_ permanent 
	make _I.04_ permanent 
	make _I.03_ permanent 
	end quest
--otherwise quest would hang on until end of final timer